<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>订购成功</title>
    <link rel="stylesheet" href="./index.css">
</head>

<body>
    <div class="wrap_success2">
        <div>
            <img src="./success2.png" alt="">
            <div class="success2_title">退订成功</div>
        </div>
       
        <div class="success2_btn">
            关闭
        </div>
    </div>
</body>

<script src="./jq.js"></script>
<script>
     // 获取查询参数的值
     function getQueryParam(name) {
        // 获取查询字符串部分  
        var search = window.location.search.substring(1);
        // 将其分割成键值对数组  
        var params = search.split("&");
        for (var i = 0; i < params.length; i++) {
            var pair = params[i].split("=");
            // 如果找到匹配的键，返回其值  
            if (decodeURIComponent(pair[0]) === name) {
                return decodeURIComponent(pair[1] || "");
            }
        }
        // 如果没有找到，返回 null 或其他默认值  
        return null;
    }
    let title = getQueryParam('title')


    function getDeviceType() {
        var userAgent = navigator.userAgent || navigator.vendor || window.opera;

        // 判断是否为iOS设备  
        if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
            return 'iOS';
        }

        // 判断是否为Android设备  
        if (/android/i.test(userAgent)) {
            return 'Android';
        }

        // 如果都不是，则返回其他或未知  
        return 'Other';
    }

    $('.success2_btn').on('click', function (event) {
        console.log('555');
        let app = getDeviceType()
        if(app==='iOS'){
            window.webkit.messageHandlers.backHome.postMessage('webview点击了backHome')
        }

        if(app==='Android'){
            window.android.callAndroid('webview点击了backHome');
        }
      

    });

    $(document).ready(function () {
           
        $('.success2_title').text(title)
    })

</script>


</html>